package cn.springcloud.alibaba.feign.rule;

import java.util.Optional;

public class GrayRequestContextHolder {

	private static final ThreadLocal<Boolean> GRAY_REQ_THREAD_LOCAL = new ThreadLocal<>();

	public static void setGrayTag(Boolean flag) {
		GRAY_REQ_THREAD_LOCAL.set(flag);
	}

	public static Boolean getGrayTag() {
		return Optional.ofNullable(GRAY_REQ_THREAD_LOCAL.get()).orElse(false);
	}

	public static void remove() {
		GRAY_REQ_THREAD_LOCAL.remove();
	}
}
